#define _CRT_SECURE_NO_WARNINGS 1

#include"heap.h"

void test1()
{
	Heap hp;
	HeapInit(&hp);

	int arr[] = { 7,8,3,5,1,9,4,5 };
	for (int i = 0; i < sizeof(arr) / sizeof(int); i++)
	{
		HeapPush(&hp, arr[i]);
	}
	int i = 0;
	while (!Empty(&hp))
	{
		arr[i++] = HeapTop(&hp);
		HeapPop(&hp);
	}
}

void test2()
{
	Heap hp;
	HeapInit(&hp);

	int arr[] = { 7,8,3,5,1,9,4,5 };
	for (int i = 0; i < sizeof(arr) / sizeof(int); i++)
	{
		AdjustUp(arr, i);
	}

	int end = sizeof(arr) / sizeof(int) - 1;
	while (end > 0)
	{
		Swap(&arr[0], &arr[end]);

		AdjustDown(arr, end, 0);
		end--;
	}
}

int main()
{
	test2();
	return 0;

}